package com.qtyx.nms.mvp.presenter

import com.qtyx.nms.mvp.base.BaseObserver
import com.qtyx.nms.mvp.base.BasePresenter
import com.qtyx.nms.mvp.model.bean.LoginBean
import com.qtyx.nms.mvp.view.LauncherView
import com.qtyx.nms.util.shared.AppInfoShared

class LauncherPresenter (val view: LauncherView) : BasePresenter() {

    /**
     * 自动登录
     */
    fun autoLogin(){
        val map=LinkedHashMap<String,String>()
        map["username"] = AppInfoShared.getUserAccount()
        map["password"] = AppInfoShared.getUserPassword()
        requestData(getApiServer().login("自动登录", map), object : BaseObserver<LoginBean>(view,false) {
            override fun onSuccess(data: LoginBean)= view.loginSucceed(data)
            override fun onError(msg: String)= view.loginFailure()
        })
    }

}